<template>
    <el-tree
        :data="treeData"
        :props="defaultProps"
        @node-click="handleCheckChange"
        ref="treeRef"
    ></el-tree>
  </template>
   
  <script setup>
    import {  onMounted,ref} from 'vue'
  const props = defineProps({
  treeData: {
    type: Array,
    default: () => [],
  },
  defaultProps: {
    type: Object,
    default: () => ({
      children: 'children',
      label: 'label',
    }),
  },
});
 console.log(props);
 
const emit = defineEmits(['check']);
const treeRef = ref(null);
 
const handleCheckChange = (data, checked, indeterminate) => {
  emit('check', data, checked, indeterminate);
};
 
onMounted(() => {
  // 可以在这里添加一些初始化逻辑，比如默认选中节点等
});

  </script>